package com.ogilvy.audi.service.impl;


import com.ogilvy.audi.dao.ResourceDao;
import com.ogilvy.audi.model.Resource;
import com.ogilvy.audi.service.ResourceManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.jws.WebService;
import java.util.List;
import java.util.Map;

@Service("resourceManager")
@WebService(serviceName = "ResourceService", endpointInterface = "com.bright.service.ResourceManager")
public class ResourceManagerImpl extends GenericManagerImpl<Resource, Long> implements ResourceManager {
    ResourceDao resourceDao;

    @Autowired
    public ResourceManagerImpl(ResourceDao resourceDao) {
        super(resourceDao);
        this.resourceDao = resourceDao;
    }

         public List<Resource> loadUrlAuthorities(String type) {
      //  Map<String, List> urlAuthorities = new HashMap<String, List>();
             String hql="from Resource as r where r.type='"+type+"' and r.status='true' order by compositor desc";

        List<Resource> urlResources = this.getRecordsByHql(hql,null);

        return urlResources;
    }
}